package com.ymatou.apigateway.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.apigateway.parameter.AesUtil;
import com.ymatou.apigateway.parameter.OpenapiReq;
import com.ymatou.apigateway.service.OpenapiService;
import com.ymatou.apigateway.service.V1getlogisticscompaniesCall;
import com.ymatou.iapi.openapibiz.parameter.AuthorizeBean;
import com.ymatou.iapi.openapibiz.parameter.NewThirdPartyAppBean;
import com.ymatou.iapi.openapibiz.service.AuthorizeCall;
import com.ymatou.iapi.openapibiz.service.NewThirdPartyAppCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.OpenApiBizCallService;
import com.ymttest.database.model.Application;
import com.ymttest.database.model.AuthCode;
import com.ymttest.database.sqlwapper.OpenApiWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
/**
*获取买手可用物流公司列表
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_V1getlogisticscompanies {
	private static OpenapiReq openapiReq;

	private static V1getlogisticscompaniesCall v1getlogisticscompaniesCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取买手可用物流公司列表");
	}

	@Before
	public void caseUp() {

		openapiReq = new OpenapiReq();

		openapiReq.setApp_id("xXmMemj5nxVN8JY4zG");
		openapiReq.setMethod("ymatou.logistics.companies.get");

		v1getlogisticscompaniesCall = new V1getlogisticscompaniesCall();

	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(v1getlogisticscompaniesCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_001() {
		Logger.start(true, "获取买手可用物流公司列表");
		try {
			long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));

			Logger.info("sellerId:" + sellerId);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);

			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0000", v1getlogisticscompaniesCall.getCode(),
					"验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_002() {
		Logger.start(true, "Auth_code错误");
		try {
			long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));
			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code("RIzShHVcaUQbIuMYbIlEl9xaQnEOa3zz11");
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);
			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0002", v1getlogisticscompaniesCall.getCode(),
					"验证Code");
			Logger.verifyEquals("非法授权码",
					v1getlogisticscompaniesCall.getMessage(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_003() {
		Logger.start(true, "Sign_method错误");
		try {
			long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));
			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD6");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);
			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0001", v1getlogisticscompaniesCall.getCode(),
					"验证Code");
			Logger.verifyEquals("sign_method 必填传 MD5 ",
					v1getlogisticscompaniesCall.getMessage(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_004() {
		Logger.start(true, "timestamp十分钟前");
		try {

			long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));
			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getBeforeOrNextMunite(-15));
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);
			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0003", v1getlogisticscompaniesCall.getCode(),
					"验证Code");
			Logger.verifyEquals("非法请求时间",
					v1getlogisticscompaniesCall.getMessage(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_005() {
		Logger.start(true, "timestamp十分钟后");
		try {
			long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));
			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getBeforeOrNextMunite(15));
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);

			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0003", v1getlogisticscompaniesCall.getCode(),
					"验证Code");
			Logger.verifyEquals("非法请求时间",
					v1getlogisticscompaniesCall.getMessage(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_006() {
		Logger.start(true, "sign错误");
		try {
			long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));
			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign("F769DE17FF18590F64F28E28EF4C10290");

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);
			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0004", v1getlogisticscompaniesCall.getCode(),
					"验证Code");
			Logger.verifyEquals("验签失败",
					v1getlogisticscompaniesCall.getMessage(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_007() {
		Logger.start(true, "nonce_str长度超出32位");
		try {
			long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));
			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(33));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);
			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0001", v1getlogisticscompaniesCall.getCode(),
					"验证Code");
			Logger.verifyEquals("非法nonceStr!",
					v1getlogisticscompaniesCall.getMessage(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_008() {
		Logger.start(true, "Auth_code空");
		try {
			long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));
			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);
			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0001", v1getlogisticscompaniesCall.getCode(),
					"验证Code");
			Logger.verifyEquals("auth_code 必填!",
					v1getlogisticscompaniesCall.getMessage(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_009() {
		Logger.start(true, "Sign_method空");
		try {
			long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));
			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);
			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0001", v1getlogisticscompaniesCall.getCode(),
					"验证Code");
			Logger.verifyEquals("sign_method 必填传 MD5 ",
					v1getlogisticscompaniesCall.getMessage(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_010() {
		Logger.start(true, "timestamp空");
		try {
			long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));
			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);
			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0001", v1getlogisticscompaniesCall.getCode(),
					"验证Code");
			Logger.verifyEquals("timestamp 必填!",
					v1getlogisticscompaniesCall.getMessage(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_011() {
		Logger.start(true, "sign空");
		try {
			long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));
			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);
			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0001", v1getlogisticscompaniesCall.getCode(),
					"验证Code");
			Logger.verifyEquals("sign 必填!",
					v1getlogisticscompaniesCall.getMessage(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_012() {
		Logger.start(true, "nonce_str空");
		try {
			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(
							Long.valueOf(EnvSetup.getData("SellerId"))).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);
			v1getlogisticscompaniesCall.setUrl(url);

			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0001", v1getlogisticscompaniesCall.getCode(),
					"验证Code");
			Logger.verifyEquals("nonce_str 必填!",
					v1getlogisticscompaniesCall.getMessage(), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_013() {
		Logger.start(true, "新建自主开发用户登录成功-缓存一分钟");
		try {

			OpenApiBizCallService OpenApiBizCallService = new OpenApiBizCallService();

			AuthorizeBean authorizeBean = OpenApiBizCallService
					.createAuthorizeBean_USER_DEV();
			AuthorizeCall authorizeCall = OpenApiBizCallService
					.authorizeCall(authorizeBean);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper
					.selectApplicationBySellerId(
							new Long(authorizeBean.getSellerId().toString()))
					.get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			Thread.sleep(120000);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);

			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0000", v1getlogisticscompaniesCall.getCode(),
					"验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_014() {
		Logger.start(true, "第三方应用登录成功-缓存一分钟");
		try {

			OpenApiBizCallService OpenApiBizCallService = new OpenApiBizCallService();

			NewThirdPartyAppBean newThirdPartyAppBean = OpenApiBizCallService
					.createNewThirdPartyAppBean();
			NewThirdPartyAppCall newThirdPartyAppCall = OpenApiBizCallService
					.newthirdpartyappCall(newThirdPartyAppBean);

			AuthorizeBean authorizeBean = OpenApiBizCallService
					.createAuthorizeBean_THIRD_PARTY(newThirdPartyAppCall
							.getAppId());
			AuthorizeCall authorizeCall = OpenApiBizCallService
					.authorizeCall(authorizeBean);

			Thread.sleep(120000);

			OpenApiWapper openApiWapper = new OpenApiWapper();

			Application application = openApiWapper.selectApplicationById(
					authorizeBean.getAppId()).get(0);

			String app_id = application.getApp_id();
			String app_secret = application.getApp_secret();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);

			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0000", v1getlogisticscompaniesCall.getCode(),
					"验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	//	@Test
	//	@Category({P1.class})
	//	@TestCase
	//	public void Tc_V1getlogisticscompanies_015() {
	//		Logger.start(true,"修改授权，老的AuthCode登录失败，新的Authcode登录成功-缓存一分钟");
	//		try {
	//			
	//			OpenApiBizCallService OpenApiBizCallService = new OpenApiBizCallService();
	//			
	//			AuthorizeBean authorizeBean = OpenApiBizCallService.createAuthorizeBean_USER_DEV();
	//			AuthorizeCall authorizeCall = OpenApiBizCallService.authorizeCall(authorizeBean);
	//			
	//			String old
	//	
	//			OpenApiWapper openApiWapper = new OpenApiWapper();
	//			
	//			Application application = openApiWapper
	//					.selectApplicationBySellerId(new Long(authorizeBean.getSellerId().toString())).get(0);
	//
	//			String app_id = application.getApp_id();
	//			String app_secret = application.getApp_secret();
	//
	//			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
	//					.get(0);
	//			
	//			Thread.sleep(120000);
	//
	//			openapiReq.setApp_id(app_id);
	//			openapiReq.setSign_method("MD5");
	//			openapiReq.setAuth_code(authCode.getAuth_code());
	//			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
	//			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
	//			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
	//					AesUtil.decrypt(app_secret)));
	//		
	//			String url = String
	//					.format("http://apigateway.ymatou.com/api/v1?app_id=%s&method=ymatou.logistics.companies.get",
	//							app_id);
	//
	//			v1getlogisticscompaniesCall.setUrl(url);				
	//
	//			v1getlogisticscompaniesCall.setData(openapiReq);
	//			v1getlogisticscompaniesCall.callService();			
	//			
	//			Logger.verifyEquals("0000", v1getlogisticscompaniesCall.getCode(), "验证Code");
	//			Logger.verifyEquals("true", v1getlogisticscompaniesCall.getSuccess(), "验证Code");
	//			
	//		} catch (Exception e) {
	//			Logger.fail(e);
	//		}
	//	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_015() {
		Logger.start(true, "获取买手可用物流公司列表-stg");
		try {
			String app_id = "xEKV2MsuQy91bOfiov";
			String app_secret = "D6B05B1E85837F3118A71D82370C646E4B2F29618FEF1F94D39E0CE9F536101AA61AE6EDD53ACC32EF45346781E0D2B3";
			String auth_code = "2XhQglr30eP008IFswzKZ3hafvsk6zOT";

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(auth_code);
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("https://open.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);

			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0000", v1getlogisticscompaniesCall.getCode(),
					"验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_016() {
		Logger.start(true, "获取买手可用物流公司列表-stg");
		try {
			String app_id = "6QcDcCtvV3pJknJUEp";
			String app_secret = "95605832511B6C85DB2D0FA9E3ACBB61FE3E1730322EF9CCA09E7ED5E523721461BEC16080D01798E84218559F4A6177";
			String auth_code = "2teKsa6gaiSUwxsACry9hXIaVsTEXqqV";

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(auth_code);
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("https://open.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);

			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0000", v1getlogisticscompaniesCall.getCode(),
					"验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_V1getlogisticscompanies_017() {
		Logger.start(true, "获取买手可用物流公司列表-stg");
		try {
			String app_id = "YdCvtjfVGsnXDDebze";
			String app_secret = "F087C6FEBBA713EC264E818AB1F5B62A9A19035B6E9D4D0FC507162D68762830A8EDB428113AF0300B17481375C5D98A";
			String auth_code = "0ckUSxW5hQjElioRE4L3kGyKK9UrQzFg";

			openapiReq.setApp_id(app_id);
			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(auth_code);
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			String url = String
					.format("https://open.ymatou.com/apigateway/v1?app_id=%s&method=ymatou.logistics.companies.get",
							app_id);

			v1getlogisticscompaniesCall.setUrl(url);

			v1getlogisticscompaniesCall.setData(openapiReq);
			v1getlogisticscompaniesCall.callService();

			Logger.verifyEquals("0000", v1getlogisticscompaniesCall.getCode(),
					"验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

}